﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace QLKTX1._0.GUI.QLSV
{
    public partial class FrmTimKiem : Form
    {
        private string maSV;

        private string hoTen;

        private string cmnd;

        private string dob;

        public string DOB
        {
            get { return dob; }

            set { dob = value; }
        }

        public string CMND
        {
            get { return cmnd; }
            set { cmnd = value; }
        }
       
        public string MaSV
        {
            get { return this.maSV; }

            set { maSV = value; }
        }

        public string HoTen
        {
            get { return this.hoTen; }
            set { this.hoTen = value; }
        }       
       
        public FrmTimKiem()
        {
            InitializeComponent();
        }        

        private void button2_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void groupBox1_Enter(object sender, EventArgs e)
        {

        }

        private void FrmTimKiem_Load(object sender, EventArgs e)
        {
            pnID.Enabled = false;
            pnName.Enabled = false;
            pnCMND.Enabled = false;
            pnNgaySinh.Enabled = false;
            OK.Enabled = false;
        }

        private void radioButton1_CheckedChanged(object sender, EventArgs e)
        {
            pnID.Enabled = true;
            txtID.Focus();
            txtID.ForeColor = Color.Red;         
            txtHoTen.Text = "";
            txtCMND.Text = "";
            dtpNgaySinh.Text = DateTime.Now.ToString("dd/MM/yyyy");
            pnName.Enabled = false;
            pnNgaySinh.Enabled = false;
            pnCMND.Enabled = false;
            if (!OK.Enabled)
            {
                OK.Enabled = true;
            }
        }

        private void radioButton2_CheckedChanged(object sender, EventArgs e)
        {
            pnID.Enabled = false;
            pnNgaySinh.Enabled = false;
            pnCMND.Enabled = false;
            pnName.Enabled = true;
            txtHoTen.ForeColor = Color.Red;           
            txtHoTen.Focus();      
            txtID.Text = "";
            txtCMND.Text = "";
            dtpNgaySinh.Text = DateTime.Now.ToString("dd/MM/yyyy");
            if (!OK.Enabled)
            {
                OK.Enabled = true;
            }
        }

        private void OK_Click(object sender, EventArgs e)
        {
            this.MaSV = txtID.Text;
            this.HoTen = txtHoTen.Text;
            this.CMND = txtCMND.Text;
            this.DOB = dtpNgaySinh.Text;
           
            this.DialogResult = DialogResult.OK;
            this.Close();
        }

        private void optNgaySinh_CheckedChanged(object sender, EventArgs e)
        {
            pnID.Enabled = false;
            pnName.Enabled = false;
            pnCMND.Enabled = false;
            pnNgaySinh.Enabled = true;
            txtID.Text = "";
            txtHoTen.Text = "";
            txtCMND.Text = "";
            dtpNgaySinh.Focus();
            if (!OK.Enabled)
            {
                OK.Enabled = true;
            }
        }

        private void optCMND_CheckedChanged(object sender, EventArgs e)
        {
            pnID.Enabled = false;
            pnName.Enabled = false;
            pnNgaySinh.Enabled = false;
            pnCMND.Enabled = true;
            txtID.Text = "";
            txtHoTen.Text = "";
            dtpNgaySinh.Text = DateTime.Now.ToString("dd/MM/yyyy");
            txtCMND.Focus();
            txtCMND.ForeColor = Color.Red;
            if (!OK.Enabled)
            {
                OK.Enabled = true;
            }
        }
    }
}
